<template xmlns:v-on="http://www.w3.org/1999/xhtml">
    <div id="app" class="user">
        <div class="userNav commenNav">
            <div>
                <div :class="{iconImg:isiconImg,iconImgs:isiconImgs}" @click="codepage"></div>
                <div id="pillmanage">监管码管理</div>
                <input type="button" value="监管码生产" @click="codeproduct">
            </div>
            <div class="userNavT">
                <div>
                    <input type="text" placeholder="输入药品名称开始搜索" v-model="pillnameSearch" @keyup.enter='searchfn'>
                    <div @click="searchfn"><img :src="searchImg" alt=""></div>
                </div>
            </div>
        </div>
        <div class="userCotent">
            <div class="datails">
                <ul>
                    <li class="firstLi">
                        <div>序号</div>
                        <div>药品通用名称</div>
                        <div>剂型</div>
                        <div>包装级数</div>
                        <div>药品规格</div>
                        <div>所需监管码数量</div>
                        <div>创建时间</div>
                        <div>操作</div>
                    </li>
                    <li v-if="nullshow" class="nullContent">
                        暂时没有数据
                    </li>
                    <li v-else v-for="(pill,index) in pills" class="dataLi">
                        <div>{{index + 1}}</div>
                        <div :title="pill.drugName" @click="coderecord(index)">{{pill.drugName}}</div>
                        <div>{{pill.dosageForm}}</div>
                        <div>{{pill.packingLevel}}</div>
                        <div>{{pill.minPackagingNumber}} {{pill.specificationUnit}}/{{pill.minPackagingUnit}}</div>
                        <div>{{pill.supervisionCodeNumber}}</div>
                        <div>{{pill.createDate}}</div>
                        <div class="caozuo">
                            <span style="cursor: pointer" @click="make(index)" v-show="pill.supervisionCodeStatus == '1'">生成</span>
                            <span style="cursor: pointer" @click="codedown(index)" v-show="pill.supervisionCodeStatus == '2'">下载</span>
                            <span style="cursor: pointer" @click="codeedit(index)" v-show="pill.supervisionCodeStatus == '1'">修改</span>
                            <span v-show="pill.supervisionCodeStatus == '3'"><img src="../../../static/img/load.gif"></span>
                        </div>

                    </li>
                </ul>
                <!--分页-->
                <div class="block" v-show="isPageshow" style="text-align: center;margin-top:50px;margin-bottom: 30px;">
                    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 50, 100]"
                        :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
                        </el-pagination>
                </div>

            </div>
        </div>
        <!--提示框-->
        <div id="tipMsg" v-show="istipMsg">
            <div class="approval-leave-bg">
                <div class="tipBox">
                    <div>
                        <p style="color:#fff;font-size: 18px;margin-left: 10px;">提示</p>
                    </div>
                    <div>
                        <p style="padding:40px 0;text-align: center;width:100%;">你确定要删除该信息吗？删除后将无法修复。</p>
                        <div class="yesNo">
                            <input type="button" value="取消" id="yes" @click="cancle">
                            <input type="button" value="确定" id="no" @click="">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--<component v-bind:is='whichComponents' keep-alive></component>-->
    </div>
</template>
<script>
    require("../../../config/index.js")
    import {
        mapActions
    } from 'vuex'
    export default {
        name: 'user',
        data() {
            return {
                pageSize: 10,
                isPageshow: true,
                pillnameSearch: '',
                istipMsg: false,
                // whichComponents:'stockList',
                isiconImg: true,
                isiconImgs: false,
                total: 10,
                currentPage: 1,
                nullshow: false,
                searchImg: '/static/img/搜索.png',
                searchImgs: '/static/img/搜索点击.png',
                users: [],
                // loading: true,
                pills: [],
                timer: []
            }
        },
        filters: {

        },
        created: function () {
            this.getcode(1)
        },
        methods: {
            codepage: function () {
                this.isiconImg = false
                this.isiconImgs = true
                document.querySelector("#pillmanage").style.color = '#666'
            },
            searchfn: function () {
                this.searchImg = this.searchImgs
                this.currentPage = 1
                this.codenameSearchlist({
                    pageSize: this.pageSize,
                    pageNo: this.currentPage,
                    jsonFilter: JSON.stringify({
                        "drugName": this.pillnameSearch
                    })
                }).then((data) => {
                    console.log(data, '查询')
                    if (data.code == 200) {
                        this.total = data.data.count
                        for (let i = 0; i < data.data.list.length; i++) {
                            if (data.data.list[i].specificationUnit == '1') {
                                data.data.list[i].specificationUnit = '片'
                            } else if (data.data.list[i].specificationUnit == '2') {
                                data.data.list[i].specificationUnit = '袋'
                            } else if (data.data.list[i].specificationUnit == '3') {
                                data.data.list[i].specificationUnit = '粒'
                            } else if (data.data.list[i].specificationUnit == '4') {
                                data.data.list[i].specificationUnit = '瓶'
                            } else if (data.data.list[i].specificationUnit == '5') {
                                data.data.list[i].specificationUnit = '支'
                            }

                            if (data.data.list[i].minPackagingUnit == '1') {
                                data.data.list[i].minPackagingUnit = '盒'
                            } else if (data.data.list[i].minPackagingUnit == '2') {
                                data.data.list[i].minPackagingUnit = '袋'
                            } else if (data.data.list[i].minPackagingUnit == '3') {
                                data.data.list[i].minPackagingUnit = '箱'
                            }

                            if (data.data.list[i].dosageForm == '1') {
                                data.data.list[i].dosageForm = '颗粒剂'
                            }else if(data.data.list[i].dosageForm == '2') {
                                data.data.list[i].dosageForm = '片剂'
                            }else if(data.data.list[i].dosageForm == '3') {
                                data.data.list[i].dosageForm = '胶囊剂'
                            }else if(data.data.list[i].dosageForm == '4') {
                                data.data.list[i].dosageForm = '软胶囊剂'
                            }else if(data.data.list[i].dosageForm == '5') {
                                data.data.list[i].dosageForm = '合剂'
                            }else if(data.data.list[i].dosageForm == '6') {
                                data.data.list[i].dosageForm = '糖浆剂'
                            }else if(data.data.list[i].dosageForm == '7') {
                                data.data.list[i].dosageForm = '注射剂'
                            }else if(data.data.list[i].dosageForm == '8') {
                                data.data.list[i].dosageForm = '软膏剂'
                            }else if(data.data.list[i].dosageForm == '9') {
                                data.data.list[i].dosageForm = '眼用制剂'
                            }else if(data.data.list[i].dosageForm == '10') {
                                data.data.list[i].dosageForm = '鼻用制剂'
                            }else if(data.data.list[i].dosageForm == '11') {
                                data.data.list[i].dosageForm = '栓剂'
                            }else if(data.data.list[i].dosageForm == '12') {
                                data.data.list[i].dosageForm = '丸剂'
                            }else if(data.data.list[i].dosageForm == '13') {
                                data.data.list[i].dosageForm = '乳膏剂'
                            }else if(data.data.list[i].dosageForm == '14') {
                                data.data.list[i].dosageForm = '糊剂'
                            }else if(data.data.list[i].dosageForm == '15') {
                                data.data.list[i].dosageForm = '吸入制剂'
                            }else if(data.data.list[i].dosageForm == '16') {
                                data.data.list[i].dosageForm = '喷雾剂'
                            }else if(data.data.list[i].dosageForm == '17') {
                                data.data.list[i].dosageForm = '气雾剂'
                            }else if(data.data.list[i].dosageForm == '18') {
                                data.data.list[i].dosageForm = '凝胶剂'
                            }else if(data.data.list[i].dosageForm == '19') {
                                data.data.list[i].dosageForm = '散剂'
                            }else if(data.data.list[i].dosageForm == '20') {
                                data.data.list[i].dosageForm = '搽剂'
                            }else if(data.data.list[i].dosageForm == '21') {
                                data.data.list[i].dosageForm = '涂剂'
                            }else if(data.data.list[i].dosageForm == '22') {
                                data.data.list[i].dosageForm = '涂膜剂'
                            }else if(data.data.list[i].dosageForm == '23') {
                                data.data.list[i].dosageForm = '酊剂'
                            }else if(data.data.list[i].dosageForm == '24') {
                                data.data.list[i].dosageForm = '贴剂'
                            }else if(data.data.list[i].dosageForm == '25') {
                                data.data.list[i].dosageForm = '贴膏剂'
                            }else if(data.data.list[i].dosageForm == '26') {
                                data.data.list[i].dosageForm = '口服溶液剂'
                            }else if(data.data.list[i].dosageForm == '27') {
                                data.data.list[i].dosageForm = '口服混悬剂'
                            }else if(data.data.list[i].dosageForm == '28') {
                                data.data.list[i].dosageForm = '口服乳剂'
                            }else if(data.data.list[i].dosageForm == '29') {
                                data.data.list[i].dosageForm = '植入剂'
                            }else if(data.data.list[i].dosageForm == '30') {
                                data.data.list[i].dosageForm = '膜剂'
                            }else if(data.data.list[i].dosageForm == '31') {
                                data.data.list[i].dosageForm = '耳用制剂'
                            }else if(data.data.list[i].dosageForm == '32') {
                                data.data.list[i].dosageForm = '洗剂'
                            }else if(data.data.list[i].dosageForm == '33') {
                                data.data.list[i].dosageForm = '冲洗剂'
                            }else if(data.data.list[i].dosageForm == '34') {
                                data.data.list[i].dosageForm = '灌肠剂'
                            }else if(data.data.list[i].dosageForm == '35') {
                                data.data.list[i].dosageForm = '锭剂'
                            }else if(data.data.list[i].dosageForm == '36') {
                                data.data.list[i].dosageForm = '煎膏剂'
                            }else if(data.data.list[i].dosageForm == '37') {
                                data.data.list[i].dosageForm = '胶剂'
                            }else if(data.data.list[i].dosageForm == '38') {
                                data.data.list[i].dosageForm = '酒剂'
                            }else if(data.data.list[i].dosageForm == '39') {
                                data.data.list[i].dosageForm = '膏药'
                            }else if(data.data.list[i].dosageForm == '40') {
                                data.data.list[i].dosageForm = '露剂'
                            }else if(data.data.list[i].dosageForm == '41') {
                                data.data.list[i].dosageForm = '茶剂'
                            }else if(data.data.list[i].dosageForm == '42') {
                                data.data.list[i].dosageForm = '流浸膏剂与浸膏剂'
                            }
                            data.data.list[i].createDate = this.UnFormatDates(data.data.list[i].createDate)
                        }

                        this.pills = data.data.list
                    } else {

                    }
                }).catch(msg => console.log(msg))
            },
            UnFormatDates(date) {
                var y, m, d, h, i, s
                var t = new Date(date)
                y = t.getFullYear()
                m = t.getMonth() + 1
                d = t.getDate()
                h = t.getHours()
                i = t.getMinutes()
                s = t.getSeconds()
                return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + ' '
                    + (h < 10 ? '0' + h : h) + ':' + (i < 10 ? '0' + i : i) + ':' + (s < 10 ? '0' + s : s)

            },
            // 获取药品管理页面数据
            getcode(i = 1) {
                this.$store.commit('showLoading');
                this.getcodelist({
                    pageSize: this.pageSize,
                    pageNo: i,
                    jsonFilter: JSON.stringify({
                        "drugName": this.pillnameSearch
                    })
                }).then((data) => {
                    this.$store.commit('hiddenLoading');
                    console.log(data);
                    if (data.code === 200) {
                        if (data.data.list.length == 0) {
                            this.isPageshow = false
                            this.nullshow = true
                        }
                        this.total = data.data.count
                        // this.pills = data.data.list
                        for (let i = 0; i < data.data.list.length; i++) {
                            if (data.data.list[i].specificationUnit == '1') {
                                data.data.list[i].specificationUnit = '片'
                            } else if (data.data.list[i].specificationUnit == '2') {
                                data.data.list[i].specificationUnit = '袋'
                            } else if (data.data.list[i].specificationUnit == '3') {
                                data.data.list[i].specificationUnit = '粒'
                            } else if (data.data.list[i].specificationUnit == '4') {
                                data.data.list[i].specificationUnit = '瓶'
                            } else if (data.data.list[i].specificationUnit == '5') {
                                data.data.list[i].specificationUnit = '支'
                            }

                            if (data.data.list[i].minPackagingUnit == '1') {
                                data.data.list[i].minPackagingUnit = '盒'
                            } else if (data.data.list[i].minPackagingUnit == '2') {
                                data.data.list[i].minPackagingUnit = '袋'
                            } else if (data.data.list[i].minPackagingUnit == '3') {
                                data.data.list[i].minPackagingUnit = '箱'
                            }

                            if (data.data.list[i].dosageForm == '1') {
                                data.data.list[i].dosageForm = '颗粒剂'
                            }else if(data.data.list[i].dosageForm == '2') {
                                data.data.list[i].dosageForm = '片剂'
                            }else if(data.data.list[i].dosageForm == '3') {
                                data.data.list[i].dosageForm = '胶囊剂'
                            }else if(data.data.list[i].dosageForm == '4') {
                                data.data.list[i].dosageForm = '软胶囊剂'
                            }else if(data.data.list[i].dosageForm == '5') {
                                data.data.list[i].dosageForm = '合剂'
                            }else if(data.data.list[i].dosageForm == '6') {
                                data.data.list[i].dosageForm = '糖浆剂'
                            }else if(data.data.list[i].dosageForm == '7') {
                                data.data.list[i].dosageForm = '注射剂'
                            }else if(data.data.list[i].dosageForm == '8') {
                                data.data.list[i].dosageForm = '软膏剂'
                            }else if(data.data.list[i].dosageForm == '9') {
                                data.data.list[i].dosageForm = '眼用制剂'
                            }else if(data.data.list[i].dosageForm == '10') {
                                data.data.list[i].dosageForm = '鼻用制剂'
                            }else if(data.data.list[i].dosageForm == '11') {
                                data.data.list[i].dosageForm = '栓剂'
                            }else if(data.data.list[i].dosageForm == '12') {
                                data.data.list[i].dosageForm = '丸剂'
                            }else if(data.data.list[i].dosageForm == '13') {
                                data.data.list[i].dosageForm = '乳膏剂'
                            }else if(data.data.list[i].dosageForm == '14') {
                                data.data.list[i].dosageForm = '糊剂'
                            }else if(data.data.list[i].dosageForm == '15') {
                                data.data.list[i].dosageForm = '吸入制剂'
                            }else if(data.data.list[i].dosageForm == '16') {
                                data.data.list[i].dosageForm = '喷雾剂'
                            }else if(data.data.list[i].dosageForm == '17') {
                                data.data.list[i].dosageForm = '气雾剂'
                            }else if(data.data.list[i].dosageForm == '18') {
                                data.data.list[i].dosageForm = '凝胶剂'
                            }else if(data.data.list[i].dosageForm == '19') {
                                data.data.list[i].dosageForm = '散剂'
                            }else if(data.data.list[i].dosageForm == '20') {
                                data.data.list[i].dosageForm = '搽剂'
                            }else if(data.data.list[i].dosageForm == '21') {
                                data.data.list[i].dosageForm = '涂剂'
                            }else if(data.data.list[i].dosageForm == '22') {
                                data.data.list[i].dosageForm = '涂膜剂'
                            }else if(data.data.list[i].dosageForm == '23') {
                                data.data.list[i].dosageForm = '酊剂'
                            }else if(data.data.list[i].dosageForm == '24') {
                                data.data.list[i].dosageForm = '贴剂'
                            }else if(data.data.list[i].dosageForm == '25') {
                                data.data.list[i].dosageForm = '贴膏剂'
                            }else if(data.data.list[i].dosageForm == '26') {
                                data.data.list[i].dosageForm = '口服溶液剂'
                            }else if(data.data.list[i].dosageForm == '27') {
                                data.data.list[i].dosageForm = '口服混悬剂'
                            }else if(data.data.list[i].dosageForm == '28') {
                                data.data.list[i].dosageForm = '口服乳剂'
                            }else if(data.data.list[i].dosageForm == '29') {
                                data.data.list[i].dosageForm = '植入剂'
                            }else if(data.data.list[i].dosageForm == '30') {
                                data.data.list[i].dosageForm = '膜剂'
                            }else if(data.data.list[i].dosageForm == '31') {
                                data.data.list[i].dosageForm = '耳用制剂'
                            }else if(data.data.list[i].dosageForm == '32') {
                                data.data.list[i].dosageForm = '洗剂'
                            }else if(data.data.list[i].dosageForm == '33') {
                                data.data.list[i].dosageForm = '冲洗剂'
                            }else if(data.data.list[i].dosageForm == '34') {
                                data.data.list[i].dosageForm = '灌肠剂'
                            }else if(data.data.list[i].dosageForm == '35') {
                                data.data.list[i].dosageForm = '锭剂'
                            }else if(data.data.list[i].dosageForm == '36') {
                                data.data.list[i].dosageForm = '煎膏剂'
                            }else if(data.data.list[i].dosageForm == '37') {
                                data.data.list[i].dosageForm = '胶剂'
                            }else if(data.data.list[i].dosageForm == '38') {
                                data.data.list[i].dosageForm = '酒剂'
                            }else if(data.data.list[i].dosageForm == '39') {
                                data.data.list[i].dosageForm = '膏药'
                            }else if(data.data.list[i].dosageForm == '40') {
                                data.data.list[i].dosageForm = '露剂'
                            }else if(data.data.list[i].dosageForm == '41') {
                                data.data.list[i].dosageForm = '茶剂'
                            }else if(data.data.list[i].dosageForm == '42') {
                                data.data.list[i].dosageForm = '流浸膏剂与浸膏剂'
                            }
                            data.data.list[i].createDate = this.UnFormatDates(data.data.list[i].createDate)
                        }

                        this.pills = data.data.list
                        for (let i = 0; i < this.pills.length; i++) {
                            if (this.pills[i].supervisionCodeStatus == '3') {
                                this.Timer();
                                return;
                            } else {
                                this.clearTimer();
                            }
                        }
                        // console.log(this.options)
                    } else {
                        this.$message(data.message)
                    }
                }).catch(msg => console.log(msg));
            },
            Timer() {
                let self = this;
                if (self && !self._isDestroyed) {
                    const t = setTimeout(() => {
                        if (self && !self._isDestroyed)
                            self.getcode(self.currentPage, self.pageSize);
                    }, 5000);
                    this.timer.push(t);
                }
            },
            clearTimer() {
                this.timer.forEach((timer) => {
                    window.clearTimeout(timer)
                })
                this.timers = []
            },
            // 分页跳转
            handleSizeChange(val) {
                this.pageSize = val
                this.getcodelist({
                    pageSize: val,
                    pageNo: this.currentPage,
                    jsonFilter: JSON.stringify({ "drugName": this.pillnameSearch })
                }).then((data) => {
                    console.log(data, '查询')
                    if (data.code == 200) {
                        this.total = data.data.count
                        for (let i = 0; i < data.data.list.length; i++) {
                            if (data.data.list[i].specificationUnit == '1') {
                                data.data.list[i].specificationUnit = '片'
                            } else if (data.data.list[i].specificationUnit == '2') {
                                data.data.list[i].specificationUnit = '袋'
                            } else if (data.data.list[i].specificationUnit == '3') {
                                data.data.list[i].specificationUnit = '粒'
                            } else if (data.data.list[i].specificationUnit == '4') {
                                data.data.list[i].specificationUnit = '瓶'
                            } else if (data.data.list[i].specificationUnit == '5') {
                                data.data.list[i].specificationUnit = '支'
                            }

                            if (data.data.list[i].minPackagingUnit == '1') {
                                data.data.list[i].minPackagingUnit = '盒'
                            } else if (data.data.list[i].minPackagingUnit == '2') {
                                data.data.list[i].minPackagingUnit = '袋'
                            } else if (data.data.list[i].minPackagingUnit == '3') {
                                data.data.list[i].minPackagingUnit = '箱'
                            }

                            if (data.data.list[i].dosageForm == '1') {
                                data.data.list[i].dosageForm = '颗粒剂'
                            }else if(data.data.list[i].dosageForm == '2') {
                                data.data.list[i].dosageForm = '片剂'
                            }else if(data.data.list[i].dosageForm == '3') {
                                data.data.list[i].dosageForm = '胶囊剂'
                            }else if(data.data.list[i].dosageForm == '4') {
                                data.data.list[i].dosageForm = '软胶囊剂'
                            }else if(data.data.list[i].dosageForm == '5') {
                                data.data.list[i].dosageForm = '合剂'
                            }else if(data.data.list[i].dosageForm == '6') {
                                data.data.list[i].dosageForm = '糖浆剂'
                            }else if(data.data.list[i].dosageForm == '7') {
                                data.data.list[i].dosageForm = '注射剂'
                            }else if(data.data.list[i].dosageForm == '8') {
                                data.data.list[i].dosageForm = '软膏剂'
                            }else if(data.data.list[i].dosageForm == '9') {
                                data.data.list[i].dosageForm = '眼用制剂'
                            }else if(data.data.list[i].dosageForm == '10') {
                                data.data.list[i].dosageForm = '鼻用制剂'
                            }else if(data.data.list[i].dosageForm == '11') {
                                data.data.list[i].dosageForm = '栓剂'
                            }else if(data.data.list[i].dosageForm == '12') {
                                data.data.list[i].dosageForm = '丸剂'
                            }else if(data.data.list[i].dosageForm == '13') {
                                data.data.list[i].dosageForm = '乳膏剂'
                            }else if(data.data.list[i].dosageForm == '14') {
                                data.data.list[i].dosageForm = '糊剂'
                            }else if(data.data.list[i].dosageForm == '15') {
                                data.data.list[i].dosageForm = '吸入制剂'
                            }else if(data.data.list[i].dosageForm == '16') {
                                data.data.list[i].dosageForm = '喷雾剂'
                            }else if(data.data.list[i].dosageForm == '17') {
                                data.data.list[i].dosageForm = '气雾剂'
                            }else if(data.data.list[i].dosageForm == '18') {
                                data.data.list[i].dosageForm = '凝胶剂'
                            }else if(data.data.list[i].dosageForm == '19') {
                                data.data.list[i].dosageForm = '散剂'
                            }else if(data.data.list[i].dosageForm == '20') {
                                data.data.list[i].dosageForm = '搽剂'
                            }else if(data.data.list[i].dosageForm == '21') {
                                data.data.list[i].dosageForm = '涂剂'
                            }else if(data.data.list[i].dosageForm == '22') {
                                data.data.list[i].dosageForm = '涂膜剂'
                            }else if(data.data.list[i].dosageForm == '23') {
                                data.data.list[i].dosageForm = '酊剂'
                            }else if(data.data.list[i].dosageForm == '24') {
                                data.data.list[i].dosageForm = '贴剂'
                            }else if(data.data.list[i].dosageForm == '25') {
                                data.data.list[i].dosageForm = '贴膏剂'
                            }else if(data.data.list[i].dosageForm == '26') {
                                data.data.list[i].dosageForm = '口服溶液剂'
                            }else if(data.data.list[i].dosageForm == '27') {
                                data.data.list[i].dosageForm = '口服混悬剂'
                            }else if(data.data.list[i].dosageForm == '28') {
                                data.data.list[i].dosageForm = '口服乳剂'
                            }else if(data.data.list[i].dosageForm == '29') {
                                data.data.list[i].dosageForm = '植入剂'
                            }else if(data.data.list[i].dosageForm == '30') {
                                data.data.list[i].dosageForm = '膜剂'
                            }else if(data.data.list[i].dosageForm == '31') {
                                data.data.list[i].dosageForm = '耳用制剂'
                            }else if(data.data.list[i].dosageForm == '32') {
                                data.data.list[i].dosageForm = '洗剂'
                            }else if(data.data.list[i].dosageForm == '33') {
                                data.data.list[i].dosageForm = '冲洗剂'
                            }else if(data.data.list[i].dosageForm == '34') {
                                data.data.list[i].dosageForm = '灌肠剂'
                            }else if(data.data.list[i].dosageForm == '35') {
                                data.data.list[i].dosageForm = '锭剂'
                            }else if(data.data.list[i].dosageForm == '36') {
                                data.data.list[i].dosageForm = '煎膏剂'
                            }else if(data.data.list[i].dosageForm == '37') {
                                data.data.list[i].dosageForm = '胶剂'
                            }else if(data.data.list[i].dosageForm == '38') {
                                data.data.list[i].dosageForm = '酒剂'
                            }else if(data.data.list[i].dosageForm == '39') {
                                data.data.list[i].dosageForm = '膏药'
                            }else if(data.data.list[i].dosageForm == '40') {
                                data.data.list[i].dosageForm = '露剂'
                            }else if(data.data.list[i].dosageForm == '41') {
                                data.data.list[i].dosageForm = '茶剂'
                            }else if(data.data.list[i].dosageForm == '42') {
                                data.data.list[i].dosageForm = '流浸膏剂与浸膏剂'
                            }
                            data.data.list[i].createDate = this.UnFormatDates(data.data.list[i].createDate)
                        }
                        this.pills = data.data.list
                    } else {

                    }
                }).catch(msg => console.log(msg))
            },
            handleCurrentChange(val) {
                this.currentPage = val;
                this.getcode(this.currentPage)
            },
            codeproduct: function () {
                var url = '/home/codeproduce'
                this.$router.push({
                    path: url
                })
            },
            // 修改信息
            codeedit(index) {
                this.codeeditlist({
                    id: this.pills[index].superVisionWrapperId
                }).then((data) => {
                    console.log(data, '编辑监管码详细信息')
                    if (data.code == 200) {
                        let editcodeData = JSON.stringify(data.data)
                        console.log(editcodeData)
                        sessionStorage.setItem('editcodeDat', editcodeData)
                        this.$router.push({
                            path: '/home/editcode'
                        })
                    } else {
                        this.$message(data.message)
                    }
                }).catch(msg => console.log(msg))

            },
            cancle: function () {
                this.istipMsg = false
            },
            // 确定删除
            codeSure: function () {
                alert('删除')
            },
            // 下载按钮
            codedown(index) {
                window.location.href = 'http://' + global.logIp + ':' + global.logport + '/V1.0.0/supervisionWrapper/download/' + this.pills[index].superVisionWrapperId
            },
            // 生成按钮
            make(index) {
                this.makelist({
                    id: this.pills[index].superVisionWrapperId,
                    drugId: this.pills[index].drugId
                }).then((data) => {
                    console.log(data, '生成返回的信息')
                    if (data.code == 200) {
                        this.getcode(this.currentPage, this.pageSize)
                    } else {
                        let self = this;
                        this.$message(data.message);
                        this.pills[index].supervisionCodeStatus = '3';
                        this.Timer();
                    }
                })
            },
            coderecord(index) {
                this.codeeditlist({
                    id: this.pills[index].superVisionWrapperId
                }).then((data) => {
                    console.log(data, '编辑监管码详细信息')
                    if (data.code == 200) {
                        let editcodeData = JSON.stringify(data.data)
                        sessionStorage.setItem('editcodeData', editcodeData)
                        this.$router.push({
                            path: '/home/coderecord'
                        })
                    } else {
                        this.$message(data.message)
                    }
                }).catch(msg => console.log(msg))
            },
            ...mapActions(['getcodelist', 'codeeditlist', 'codenameSearchlist', 'makelist'])
        },
        beforeDestroy: function () {
            this.clearTimer();
        }
    }

</script>
<style scoped>
    .userCotent {
        margin-top: 10px;
    }
    
    .userNav>div:nth-child(1) {
        height: 25px;
        display: flex;
        margin-left: 35px;
        align-items: center;
    }
    
    .userNav>div:nth-child(1) input {
        background: #43dce7;
        border-radius: 5px;
        font-size: 14px;
        color: #fff;
        margin-left: 60px;
        width: 96px;
        height: 32px;
    }
    
    .userNav>div:nth-child(1) div {
        line-height: 25px;
        margin-left: 5px;
        padding: 0;
        color: #333;
        font-size: 14px;
    }
    
    .userNavT {
        width: 360px;
        display: flex;
        align-items: center;
        margin-right: 45px;
    }
    
    .userNavT>div:nth-child(1) {
        display: flex;
        border: 1px solid #e0e0e0;
        border-radius: 5px;
        height: 34px;
        padding: 5px 10px;
        width: 360px;
        justify-content: space-between;
    }
    
    .userNavT>div:nth-child(1) input {
        border: none;
        outline: none;
        width: 100%;
        color: #333;
        font-size: 14px;
    }
    
    .userNavT>div:nth-child(1) img {
        width: 20px;
        height: 20px;
        vertical-align: initial;
    }
    
    .userNavT>div:nth-child(1) div {
        line-height: 25px;
        margin-left: 5px;
        padding: 0;
        color: #333;
        font-size: 14px;
    }
    
    .userNavT>div:nth-child(1) div span {
        padding: 0!important;
    }
    
    .userNavT>div:nth-child(2) {
        color: #888;
        font-size: 14px;
        cursor: pointer;
    }
    
    .user {
        position: relative;
    }
    
    .datails {
        border: 1px solid #dddddd;
        width: 100%;
        background: #fff;
        /*min-width: 1289px;*/
    }
    
    .datails>ul>li {
        display: flex;
        text-align: center;
    }
    
    .datails>ul>li div {
        border-bottom: 1px solid #F2F2F2;
        border-right: 1px solid #F2F2F2;
    }
    
    .firstLi div {
        border-bottom: 1px solid #DDD;
        border-right: 1px solid #DDD;
    }
    
    .firstLi {
        height: 40px;
        line-height: 40px;
    }
    
    .firstLi div {
        width: 170px;
        color: #999;
        font-size: 14px;
    }
    
    .firstLi div:nth-child(1) {
        width: 6.5%;
    }
    
    .firstLi div:nth-child(2) {
        width: 13.5%;
    }
    
    .firstLi div:nth-child(3) {
        width: 9.9%;
    }
    
    .firstLi div:nth-child(4) {
        width: 8.4%
    }
    
    .firstLi div:nth-child(5) {
        width: 11.5%
    }
    
    .firstLi div:nth-child(6) {
        width: 13.5%
    }
    
    .firstLi div:nth-child(7) {
        width: 18%
    }
    
    .firstLi div:nth-child(8) {
        width: 18.6%
    }
    
    .dataLi {
        height: 56px;
        line-height: 56px;
        color: #333;
        font-size: 14px;
    }
    
    .dataLi div:nth-child(1) {
        width: 6.5%;
    }
    
    .dataLi div:nth-child(2) {
        width: 13.5%;
        padding: 0 5px;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        color: #35C885;
        cursor: pointer;
    }
    
    .dataLi div:nth-child(3) {
        width: 9.9%;
    }
    
    .dataLi div:nth-child(4) {
        width: 8.4%
    }
    
    .dataLi div:nth-child(5) {
        width: 11.5%
    }
    
    .dataLi div:nth-child(6) {
        width: 13.5%
    }
    
    .dataLi div:nth-child(7) {
        width: 18%
    }
    
    .dataLi div:nth-child(8) {
        width: 18.6%
    }
    
    .nullContent {
        margin-top: 302px;
        color: #DDD;
        font-size: 20px;
        justify-content: center;
    }
    
    .caozuo {
        text-align: center;
    }
    
    .caozuo span:nth-child(1) {
        color: #43dce7;
        padding: 0 30px;
    }
    
    .caozuo span:nth-child(2) {
        color: #43dce7;
    }
    
    .caozuo span:nth-child(3) {
        color: #E74343;
        padding: 0 30px;
    }
    
    .iconImg {
        background: url('/static/img/icons.png') no-repeat;
        width: 24px;
        height: 24px;
        background-position: -79px -110px;
    }
    
    .iconImgs {
        background: url('/static/img/icons.png') no-repeat;
        width: 24px;
        height: 24px;
        background-position: -108px -110px;
    }
</style>